import request from '@/utils/axios';
import appName from "../appName";
import {getStore,setStore} from '@/utils/mUtils.js'
const timeout = 900000;

let urls = {
  doubleClick: appName.NEWUNDR + '/unipnd/nucleusInit/doubleClick',
  initHistory: appName.NEWUNDR + '/unipnd/nucleusInit/initHistory',//投被历史
  notepadicd: appName.CUSTOMER + '/customermanage/notepadicd/list',//notepad
  findPos: appName.NEWUNDR + '/unipnd/nucleusInit/findPos',//保全记录
  claimHistory: appName.NEWUNDR + '/unipnd/nucleusInit/claimHistory',//理赔记录
  claimCount: appName.NEWUNDR + '/unipnd/nucleusInit/claimCount',//理赔记录个数
  findContiNucleNoteHistory: appName.GIVENUNDR + '/renewal/renewal/findContiNucleNoteHistory',//续核记录
  findHealthReport: appName.NEWUNDR + '/unipnd/nucleusInit/findHealthReport',//异常告知
  ImageQuerySearch: appName.TASK + `/cdfs/image/ImageQueryApi`,//补充告知一览、体检报告一览
  findCustomerComplaints: appName.SYSTEM + '/sqlserver/complains/queryRecordList',//投诉记录
  findPolicyByApplnum: appName.NEWUNDR + '/unipnd/customer/findPolicyByApplnum',//重客客户查询
  preQueryListByIdNum: appName.TASK + '/advance/task/preQueryListByIdNum',//预核保
  findSernoByApplnum: appName.NEWUNDR + '/unipnd/nucleusInit/findSernoByApplnum',//电子投保标识号查询
    getLevel: appName.NEWUNDR + '/unipnd/customer/getLevel',//营销员等级查询
    initPostilPremium: appName.NEWUNDR + '/unipnd/nucleusInit/initPostilPremium',//加费除外信息初始化
    getListByParams: appName.NB+'/maintain/declinatureCause/getListByParams',//延期拒保原因初始化
    findPersonHealths: appName.NEWUNDR + '/unipnd/customer/findPersonHealths',//投被保人健康告知，智能问答信息初始化
  insureHistory: appName.GIVENUNDR+'/renewal/renewal/insureHistory',//续期核保投保记录
  claimxqHistory: appName.GIVENUNDR+'/renewal/renewal/claimHistory',//续期核保理赔记录
  thjl1: appName.GIVENUNDR + '/renewal/renewal/checkArchtypeFromEuruByClmnumChdrcoy',//续期核保提核记录
  thjl2: appName.GIVENUNDR + '/renewal/renewal/findDuw0101MClmByRdocnumChksnoChdrnum',//续期核保提核记录
  thjl3: appName.GIVENUNDR + '/renewal/renewal/findDuw0101MClmByChdrcoyChdrnum',//续期核保提核记录
}
export default urls;

// url:请求路径 ，name:功能点说明
let urlsData =[
    {url:urls.initHistory,name:"投保记录查询"},
    {url:urls.notepadicd,name:"NOTEPAD查询"},
    {url:urls.findPos,name:"保全记录查询"},
    {url:urls.claimHistory,name:"理赔记录查询"},
    {url:urls.claimCount,name:"理赔记录个数查询"},
    {url:urls.findContiNucleNoteHistory,name:"续核记录查询"},
    {url:urls.findHealthReport,name:"异常告知查询"},
    {url:urls.ImageQuerySearch,name:"影像查询"},
    {url:urls.findCustomerComplaints,name:"投诉记录查询"},
    {url:urls.findPolicyByApplnum,name:"重客客户查询"},
    {url:urls.preQueryListByIdNum,name:"预核保查询"},
    {url:urls.findSernoByApplnum,name:"电子投保标识号查询"},
    {url:urls.getLevel,name:"营销员等级查询"},
    {url:urls.initPostilPremium,name:"加费除外信息初始化"},
    {url:urls.getListByParams,name:"延期拒保原因初始化"},
    {url:urls.findPersonHealths,name:"投被保人健康告知，智能问答信息初始化"},
    {url:urls.insureHistory,name:"投保记录查询"},
    {url:urls.claimxqHistory,name:"理赔记录查询"},
    {url:urls.thjl1,name:"提核原因查询"},
    {url:urls.thjl2,name:"提核原因查询"},
    {url:urls.thjl3,name:"提核原因查询"},
]

//根据路径获取异常信息功能模块说明
export function getErrSource(url) {
    let data = urlsData.find(v=> v.url==url);
    if(data){
        return data.name;
    }
    return "";
}

// 双击
export function doubleClick(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/doubleClick',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function init(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusOperate/init',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//初始化页面数据
export function initPage(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/initPage',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//初始化页面数据--取消原因
export function queryCarepky(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/queryCarepky',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//初始化加费批注信息
export function initPostilPremium(params) {
  return request({
    url: urls.initPostilPremium,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//投保历史
export function initWfOther(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/initWfOther',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//查询保单对应的核保意见
export function showNucleusNoteEuabs(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/showNucleusNoteEuabs',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//查询保单对应的照会信息
export function showNucleusNoteEubas(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/showNucleusNoteEubas',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//查询理赔记录
export function claimHistory(params) {
  return request({
    url: urls.claimHistory,
    method: 'post',
    data: params,
    timeout:timeout
  })
}
//查询理赔记录个数
export function claimCount(params) {
  return request({
    url: urls.claimCount,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保全记录--POS变更历史
export function findPos(params) {
  return request({
    url: urls.findPos,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//累计保额
export function initWfDanger(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/initWfDanger',
    method: 'post',
    data: params,
    timeout:timeout
  })
}


//查询委托人信息
export function findTrustClinetByApplnum(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/findTrustClinetByApplnum',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保存保单信息
export function saveInfo(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusUpdate/saveAllInfo',
    method: 'post',
    data: params,
    timeout:timeout
  })
}


//保存委托人信息
export function saveTrustClintByApplnum(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusUpdate/saveTrustClintByApplnum',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//个人居民身份文件
export function queryIndividualTax(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/queryIndividualTax',
    method: 'post',
    data: params,
    timeout:timeout
  })
}


//更新个人居民身份文件
export function updateIndividualTax(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusUpdate/updateIndividualTax',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保险人拼音姓名
export function showYwpyxm(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/showYwpyxm',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保存保险人拼音姓名信息
export function saveEuhmpfBySerno(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusUpdate/saveEuhmpfBySerno',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//体检报告一览
export function findExamReport(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/findExamReport',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//补充告知一览
export function findSupplementReport(params) {
  return request({
    url: appName.SYSTEM + '/unipnd/nucleusInit/findSupplementReport',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//异常告知一览
export function findHealthReport(params) {
  return request({
    url: urls.findHealthReport,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//客户投诉记录查询
export function findCustomerComplaints(params) {
  return request({
    url: urls.findCustomerComplaints,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//客户投诉记录详情查询
export function getDetailAndHistory(params) {
  return request({
    url: appName.SYSTEM + '/sqlserver/complains/getDetailAndHistory',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function customerPolicyNos(params) {
  return request({
    url: appName.POLICY + '/policyinfo/baseinfo/customerPolicyNos',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//分页模糊查询照会码
export function findPageByDimSelect(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/findPageByDimSelect',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//照会代码检查
export function checkPncodeAndZresnpdFromEufapky(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/checkPncodeAndZresnpdFromEufapky',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function countEuhcByPncodeAndFlag01(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/countEuhcByPncodeAndFlag01',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function deteRoll(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/deteRoll',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function checkSessionChange(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/checkSessionChange',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function findNACountFromEufkpf(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/findNACountFromEufkpf',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function callEuis020(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/callEuis020',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function queryCnnmpf(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/queryCnnmpf',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//国籍查询
export function querySelectNation() {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/querySelectNation',
    method: 'post',
    data: {},
    timeout:timeout
  })
}


//续核记录查询
export function findContiNucleNoteHistory(params) {
  return request({
    url: urls.findContiNucleNoteHistory,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//续核记录--核保意见
export function contiNucleNoteHistoryBmntdesc(params) {
  return request({
    url: appName.GIVENUNDR + '/renewal/renewal/contiNucleNoteHistoryBmntdesc',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//续核记录--旧版核保意见
export function findOldBmntdescByChdrnum(params) {
  return request({
    url: appName.GIVENUNDR + '/renewal/renewal/findOldBmntdescByChdrnum',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//初始化加费信息
export function showPremium(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/premium/showPremium',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//招览别查询
export function callEuis006(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/premium/callEuis006',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function callEuis019(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/premium/callEuis019',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保存加费
export function savePremium(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/premium/savePremium',
    method: 'post',
    data: params,
    timeout:timeout
  })
}


//初始化除外信息
export function showPostil(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/postil/showPostil',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保存批注主档信息
export function savePostilHead(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/postil/savePostilHead',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//保存批注明细信息
export function savePostil(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/postil/savePostil',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function findPostilListWithTrailer1(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/postil/findPostilListWithTrailer1',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//日期检查
export function checkDate(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/check/checkDate',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//根据保单号查询受理号
export function queryApplnum(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/queryApplnum',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function findSernoByApplnum(params) {
  return request({
    url: urls.findSernoByApplnum,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function getLevel(params) {
  return request({
    url: urls.getLevel,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function initHistory(params) {
  return request({
    url: urls.initHistory,
    method: 'post',
    data: params,
    headers: {'name': "aaaaa"},
    timeout:timeout
  })
}

export function findPersonsInfo(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/customer/findPersonsInfo',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function initIdwGDVOList(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/initIdwGDVOList',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function getChdrnumByClntnum(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/euab/getChdrnumByClntnum',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function findPolicyByApplnum(params) {
  return request({
    url: urls.findPolicyByApplnum,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function preQueryListByIdNum(params) {
  return request({
    url: urls.preQueryListByIdNum,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function checkWDfor400(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusInit/checkWDfor400',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function checkBank(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/check/checkBank',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function findPersonHealths(params) {
  return request({
    url: urls.findPersonHealths,
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function getEufflvlvoListByUwlevel(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/getEufflvlvoListByUwlevel',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function fGetTotallist(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/fGetTotallist',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function calRiskSuminsForJsp(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/calRiskSuminsForJsp',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function findPolplnByApplnum(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/nucleusNote/findPolplnByApplnum',
    method: 'post',
    data: params,
    timeout:timeout
  })
}
export function listNotepad(params) {
  return request({
    url: appName.NEWUNDR + '/unipnd/notepad/listNotepad',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

export function callAihebao(params) {
	return request(
		{
			url: appName.NB + '/third/robot/callAihebao',
			method: 'post',
			data: params,
			timeout:timeout
		}
	)
}
export function seeAiList(param) {
	return request(
		{
			url: appName.NB + '/third/robot/seeAiList?chdrnum='+param,
			method: 'get',
			timeout:timeout
		}
	)
}
export function queryChooseSize() {
	return request(
		{
			url: appName.NB + '/third/robot/queryChooseSize',
			method: 'get',
			timeout:timeout
		}
	)
}
export function initAmount(param){
	return request(
		{
			url:appName.NEWUNDR + '/unipnd/amount/initAmount',
			method: 'post',
			data:param,
			timeout:timeout
		}
	)
}
//查询保单是否被锁定
export function policyLockStatus(params) {
  return request({
    url: appName.TASK + '/common/policy/lockStatus',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//生成随机复杂字符串，用来绑定受理号
export function getRandomStr(){
	let tmp = getStore('newUndr_randomStr');
	if (tmp &&"" !=tmp ||undefined != tmp) {
		return tmp;
	}
	let str = Math.random().toString(36).slice(-36);
	let t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
	let a = t.length;
	let n = "";
	  for (var i = 0; i < 32; i++) n += t.charAt(Math.floor(Math.random() * a));
	let randowStr = n+str;
	setStore('newUndr_randomStr',randowStr);
	return randowStr;
}

export function clearRandomStr(params){
	return request({
	  url: appName.NEWUNDR + '/unipnd/nucleusNote/clearRandomStr',
	  method: 'post',
	  data: params,
	})
}

//获取ai核保记录
export function getAiTaskApi(params) {
  return request({
    url: appName.ILMPMAIN + '/aus/aiRemake/getAiTask',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//获取ai核保记录
export function getAiTaskRecordApi(params) {
  return request({
    url: appName.ILMPMAIN + '/aus/aiRemake/getAiTaskRecord',
    method: 'post',
    data: params,
    timeout:timeout
  })
}

//手工补录
export function repairAiTask(params) {
  return request({
    url: appName.ILMPMAIN + '/aus/aiRemake/repairAiTask',
    method: 'post',
    data: params,
  })
}

//核保详情查看
export function getPeDetailsApi(params) {
  return request({
    url: appName.ILMPMAIN + '/aus/aiRemake/getPeDetails',
    method: 'post',
    data: params,
  })
}